home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / gnu / objcissu.lha / preprocessor < prev    next >
Text File  |  1993-03-01  |  1KB  |  47 lines

  1. Date: Mon, 21 Sep 92 02:29:37 -0400
  2. From: athan@object.com (Andrew C . Athan)
  3. To: gnu-objc@prep.ai.mit.edu
  4. Subject: Preprocessor & class/instance methods
  5.  
  6.  
  7.  
  8. By the way:
  9.  
  10. (1) Has anyone considered expanding the preprocessor functionality?  One useful set of features might allow method calls to be rewritten.  
  11.  
  12. E.g., in ANSI C I can do:
  13.  
  14. #define foobar(a,b,c) barbar(c,a,b)
  15.  
  16. but how can I rewrite:
  17.  
  18. [foo setThis:a toThat:b from:c]  -->  [foo setThat:b toThis:a from:c]
  19.  
  20.  
  21.  
  22. (2) I think we need to think about the nature of class vs. instance 
  23. method declarations.  There are some inconsistencies/deficiencies in 
  24. the language <as was discussed in the @protocol thread> regarding 
  25. their declarations.  One definite miss is the inability to declare a 
  26. pointer to a _class_ object.
  27.  
  28. Another possible feature would be the ability to declare 
  29. class&instance methods.  I.e., a method that both the class and the 
  30. instance responds to (of course, the method code cannot therefore 
  31. refer to any instance variables).  E.g.:
  32.  
  33. -+ countDigitsOf:(const char *)s { ... };
  34.  
  35. instead of
  36.  
  37. + countDigitsOf:(const char *)s { ... };
  38. - countDigitsOf:(const char *)s { [[self class] countDigitsOf:s]; }
  39.  
  40. The semantics would be that countDigitsOf: is added to the method 
  41. dispatch table of both the class and instance objects.  I.e., the 
  42. call is exactly equivalent.  This would work because in theory the 
  43. instance object is a subclass of it's class object's class (Object).
  44.  
  45. Andrew Athan
  46.  
  47.